/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rlpw.util;

/**
 *
 * @author weinpau
 */
public class Pair<L, R> {

    private final L left;
    private final R right;

    public Pair(L left, R right) {
        this.left = left;
        this.right = right;
    }

    public L left() {
        return left;
    }

    public R right() {
        return right;
    }

    @Override
    public String toString() {
        return "<" + left.toString() + ", " + right.toString() + ">";
    }

    @Override
    public boolean equals(Object arg0) {
        try {
            @SuppressWarnings("unchecked")
            Pair<L, R> p = (Pair<L, R>) arg0;
            return (left().equals(p.left()) && right().equals(p.right()));
        } catch (Exception e) {
            return false;
        }
    }
}
